
<!doctype html>
<html dir="ltr" lang="zh-CN" onsubmit="log('能冒泡到html元素')" onclick="log('点击事件到达html')">
    <head id="head">
        <meta charset="utf-8"/>
        <title>事件冒泡 by司徒正美</title>
        <script>
            document.onsubmit = function(){log("能冒泡到文档对象")}
            document.onclick = function(){log("点击事件到文档对象")}
            window.onsubmit = function(){log("能冒泡到window对象")}
            function log(s){
                window.console && console.log(s);
            }
            window.onload = function(){

                var get = function(i) {
                    return document.getElementById( i );
                }
                log("xxxxxxxxxxxxxxx")
                // get("form").submit()
                get("form").click()
            }
        </script>
    </head>
    <body onsubmit="log('能冒泡到body元素')" onclick="log('点击事件到达body')">
        <div onsubmit="log('能冒泡到form元素的父元素')">
            <form id="form" onsubmit="log('能冒泡到form元素')" action="javascript:void 0">
                <fieldset onsubmit="log('能冒泡到fieldset元素')"><legend>fieldset</legend>
                    <div onsubmit="log('能冒泡到div元素')">
                        <input type="text" value="test">
                        <input type="radio">
                        <input type="checkbox"><br/>
                        <input type="password"/>
                        <input type="file"><br/>
                        <select onchange="log(this.selectedIndex)">
                            <option>
                                xxxxx
                            </option>
                            <option>
                                yyyyy
                            </option>
                            <option>
                                zzzzz
                            </option>
                            <option>
                                kkkkk
                            </option>
                        </select>
                        <textarea>test</textarea><br/>
                        <button type="submit">提交</button>
                        <input type="submit" value="提交"/><br/>
                        <input type="image" value="提交" src="http://www.baidu.com/img/baidu.gif" />
                    </div>
                </fieldset>
            </form>
        </div>
    </body>
</html>